const s = ""

var lengthOfLongestSubstring = function (s) {
    let arr_tmp = [];
    let len_res = 0;
    for (let i in s) {
        if (arr_tmp.indexOf(s[i]) == -1) { //-1表示没找到
            arr_tmp.push(s[i]);
        } else {
            if (arr_tmp.length > len_res) {
                len_res = arr_tmp.length;
            }
            arr_tmp = [];
            arr_tmp.push(s[i]);
        }
    }
    return len_res;
};

console.log(lengthOfLongestSubstring(s));

// var subString = function (s) {
//     let arr = []
//     for (let i in s) {
//         arr.push(s[i]);
//     }
//     return arr.length;
// }
// console.log(subString(s));